/*
 * (C) 2012	Sheng Yi
 * unlink a file, just like hard link in linux
 */

#include "apue.h"
#include <fcntl.h>

int main(int argc, char *argv[])
{
	/* to link a file */
	if (argc != 2)
		err_quit("usge: a.out existpath");

	if (open(argv[1], O_RDWR) < 0)
		err_quit("open file error");
	if (unlink(argv[1]) != 0)
		err_quit("unlink error");

	printf("file unlinked\n");
	sleep(15);
	printf("done\n");
	return 0;
}
